package com.hao.tool.extra.cloud.module.ali.entity;

import com.fasterxml.jackson.annotation.JsonAlias;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * description
 *
 * @author HaoZ on CMHK.hainan
 * @date 2021/6/10 下午8:12
 */
@Getter
@Setter
public class TextOcrResult {

    private String sid;
    @JsonAlias("prism_version")

    private String prismVersion;
    @JsonAlias("prism_wnum")
    private Integer prismWnum;
    @JsonAlias("prism_wordsInfo")
    private List<WordInfo> prismWordsInfo;

    private String prismWordsInfos;

    private Integer height;
    private Integer width;
    private Integer orgHeight;
    private Integer orgWidth;
    private String content;

    @Getter
    @Setter
    private static class WordInfo {
        private String word;
    }

    public String getPrismWordsInfos() {
        StringBuffer stringBuffer = new StringBuffer();
        if (prismWordsInfo != null) {
            for (WordInfo wordInfo : prismWordsInfo) {
                stringBuffer.append(wordInfo.getWord()).append("\n");
            }
        }
        return stringBuffer.toString();
    }
}
